import java.util.*;

public class Test {

    /**
     * 消除相邻相同的字符
     * @param args
     */
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String str = in.nextLine();
            Stack<Character> stack = new Stack<>();
            int i = 0;
            while(i < str.length()) {
                char ch = str.charAt(i);
                if(stack.size() > 0 && ch == stack.peek()) {
                    stack.pop();
                }else {
                    stack.push(ch);
                }
                i++;

            }
            if(stack.size() == 0) {
                System.out.println(0);
            }else {
                int size = stack.size();
                char[] arr = new char[size];
                for (int j = size-1; j >= 0; j--) {
                    arr[j] = stack.pop();
                }
                for (int j = 0; j < size; j++) {
                    System.out.print(arr[j]);
                }
            }

        }
    }
    public boolean isSubsequence (String S, String T) {
        // 判断S是否是T的一个子序列，S中的元素T必须都有
        //1.两个相同的字符串
        if(S.compareTo(T) == 0) {
            return true;
        }

        Set<Character> set = new HashSet<>();
        //2.S中的一些元素T中不存在
        for (int i = 0; i < S.length(); i++) {
            char ch = T.charAt(i);
            set.add(ch);
        }
        for (int i = 0; i < T.length(); i++) {
            char ch = T.charAt(i);
            if(!set.contains(ch)) {
                return false;
            }
        }
        //3.
        int is = 0;
        int it = 0;
        while (it < T.length() && is < S.length()) {
            if(S.charAt(is) == T.charAt(it)) {
                is++;
                it++;
            }else {
                it++;
            }
        }
        if(is >= S.length()) {
            return true;
        }else {
            return false;
        }

    }


}
